﻿namespace WebApplication1
{
    public class MyHttp
    {
        IHttpClientFactory _factory;
        public MyHttp(IHttpClientFactory factory) {
            _factory = factory;
        }
        //static HttpClient client = new HttpClient();
        public async Task<string> GetAsync( string url)
        {
            HttpClient client =_factory.CreateClient();
            //HttpClient client = new HttpClient();
            Console.WriteLine(client.GetHashCode());
            using var res = await client.GetAsync(url);
            string str = await res.Content.ReadAsStringAsync();
            return str;
        }
    }
}
